# location ~/.tmux.conf and tmux source-file ~/.tmux.conf

# basic
set -g history-limit 65535
bind r source ~/.tmux.conf \; display "Configuration reloaded!"

# select is copy and use alt or option to use system cursor to copy
set-option -g mouse on
setw -g automatic-rename off

# color, xterm256
color_white="#eeeeee"
color_dark="#222222"
color_gray="#aaaaaa"
color_yellow="#f6d55c"
color_orange="colour166"
color_purple="colour134"
color_red="#ed553b"
color_green="#3caea6"
color_blue="#20639b"

color_status_text="$color_white"
color_status_bg="$color_blue"

# color
set -g status-style "fg=$color_status_text,bg=$color_status_bg"
set -g pane-active-border-fg "$color_orange"

# status bar
wg_date="#[fg=$color_status_text]%b-%d %H:%M#[default]"
wg_user_host="#[fg=$color_status_text]#(whoami)#[default]@#H"
wg_is_zoomed="#[fg=$color_red]#{?window_zoomed_flag,[Z],}#[default]"
wg_is_keys_off="#[fg=$color_purple]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]"

set -g status-right-length 100
set -g status-right "$wg_is_keys_off $wg_is_zoomed | $wg_user_host | $wg_date"

# Split panes
# bind | split-window -h -c "#{pane_current_path}"
# bind _ split-window -v -c "#{pane_current_path}"

# nested
bind -T root F12  \
  set prefix None \;\
  set key-table off \;\
  set -g status-bg '#222222' \;\
  set status-style "fg=$color_gray,bg=$color_dark" \;\
  if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
  refresh-client -S \;\

bind -T off F12 \
  set -u prefix \;\
  set -u key-table \;\
  set status-style "fg=$color_status_text,bg=$color_status_bg" \;\
  refresh-client -S
